package gam.t1.appraisal2.dinv.view.impl;

import gam.t1.appraisal2.dinv.DataInventory;
import gam.t1.appraisal2.dinv.view.CollectionsView;
import gam.t1.appraisal2.dinv.view.SingleView;
import gam.t1.appraisal2.dinv.view.View2DCoordinate;
import org.bukkit.inventory.ItemStack;

import java.util.function.Function;
import java.util.function.Predicate;

public final class ClickBlock<T extends CollectionsView> implements SingleView<T> {
    private int index;
    private T sys;
    private Predicate<T> clickHandler;
    private Function<T, ItemStack> itemShowHandler;
    private View2DCoordinate coordinate;
    private DataInventory handler;

    public ClickBlock() {
    }

    public ClickBlock(int index, T sys, Predicate<T> clickHandler, Function<T, ItemStack> itemShowHandler, DataInventory handler) {
        this.index = index;
        this.sys = sys;
        this.clickHandler = clickHandler;
        this.itemShowHandler = itemShowHandler;
        this.handler = handler;
    }

    @Override
    public DataInventory getHandle() {
        return handler;
    }

    @Override
    public View2DCoordinate getCoordinate() {
        return coordinate;
    }

    @Override
    public int getIndex() {
        return index;
    }

    @Override
    public Predicate<T> getClickHandler() {
        return clickHandler;
    }

    @Override
    public Function<T, ItemStack> getItemShowHandler() {
        return itemShowHandler;
    }

    @Override
    public T getHandler() {
        return sys;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public void setSys(T sys) {
        this.sys = sys;
    }

    public void setClickHandler(Predicate<T> clickHandler) {
        this.clickHandler = clickHandler;
    }

    public void setItemShowHandler(Function<T, ItemStack> itemShowHandler) {
        this.itemShowHandler = itemShowHandler;
    }

    public void setCoordinate(View2DCoordinate coordinate) {
        this.coordinate = coordinate;
    }

    public void setHandler(DataInventory handler) {
        this.handler = handler;
    }
}
